/*
 * PyGeoState.cpp
 *
 *  Created on: Dec 28, 2011
 *      Author: allan
 */

#include "PyGeoState.h"

// GeoReact includes
#include <GeoReact.h>

// Boost includes
#include <boost/python.hpp>
using namespace boost::python;

void export_GeoState()
{
	void (GeoState::*SetComposition)(const VectorXd&) = 
		&GeoState::SetComposition;
	
	void (GeoState::*SetCompositionWithConstant)(double) = 
		&GeoState::SetComposition;
	
	void (GeoState::*Update)(double, double, const VectorXd&) = 
		&GeoState::Update;
	
	void (GeoState::*UpdateWithConstant)(double, double, double) = 
		&GeoState::Update;
	
	class_<GeoState>("GeoState")
		.def(init<>())
		
		.def(init<const GeoState&>())
		
		.def(init<const KineticSystem&>())
		
		.add_property("temperature",
			&GeoState::GetTemperature,
			&GeoState::SetTemperature)
		
		.add_property("pressure",
			&GeoState::GetPressure,
			&GeoState::SetPressure)
		
		.add_property("composition",
			make_function(&GeoState::GetComposition,
				return_internal_reference<>()),
			SetComposition)
		
		.add_property("composition",
			make_function(&GeoState::GetComposition,
				return_internal_reference<>()),
			SetCompositionWithConstant)
		
		.add_property("T",
			&GeoState::GetTemperature,
			&GeoState::SetTemperature)
		
		.add_property("P",
			&GeoState::GetPressure,
			&GeoState::SetPressure)
		
		.add_property("n",
			make_function(&GeoState::GetComposition,
				return_internal_reference<>()),
			SetComposition)
		
		.add_property("n",
			make_function(&GeoState::GetComposition,
				return_internal_reference<>()),
			SetCompositionWithConstant)
		
		.add_property("activities",
			make_function(&GeoState::GetActivities,
				return_internal_reference<>()))
		
		.add_property("activity_coefficients",
			make_function(&GeoState::GetActivityCoefficients, 
				return_internal_reference<>()))
		
		.add_property("kinetic_rates",
			make_function(&GeoState::GetKineticRates, 
				return_internal_reference<>()))
		
		.def("SetSpeciesMoles",
			&GeoState::SetSpeciesMoles)
		
		.def("SetSpeciesMass",
			&GeoState::SetSpeciesMass)
		
		.def("Update",
			Update)
		
		.def("Update",
			UpdateWithConstant)			
		
		.def("Moles",
			&GeoState::Moles)
		
		.def("Mass",
			&GeoState::Mass)
			
		.def("Activity",
			&GeoState::Activity)
			
		.def("ActivityCoefficient",
			&GeoState::ActivityCoefficient)
			
		.def("KineticRate",
			&GeoState::KineticRate)
			
		.def("Acidity",
			&GeoState::Acidity)
			
		.def("IonicStrengthEffective",
			&GeoState::IonicStrengthEffective)
			
		.def("IonicStrengthStoichiometric",
			&GeoState::IonicStrengthStoichiometric)
			
		.def("PartialPressureGas",
			&GeoState::PartialPressureGas)
			
		.def("SaturationIndexMineral",
			&GeoState::SaturationIndexMineral)
			
		.def(self_ns::str(self_ns::self));
}
